<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Hammerspoon docs: SendToOmniFocus</title>
    <style type="text/css">
      a { text-decoration: none; }
      a:hover { text-decoration: underline; }
      th { background-color: #DDDDDD; vertical-align: top; padding: 3px; }
      td { width: 100%; background-color: #EEEEEE; vertical-align: top; padding: 3px; }
      table { width: 100% ; border: 1px solid #0; text-align: left; }
      section > table table td { width: 0; }
    </style>
    <link rel="stylesheet" href="docs.css" type="text/css" media="screen" />
  </head>
  <body>
    <header>
      <h1><a href="./index.html">docs</a> &raquo; SendToOmniFocus</h1>
      <p>Handles &quot;send current item to OmniFocus&quot; for multiple applications</p>
<p>The following applications are supported: out of the box: Outlook, Evernote, Mail, Chrome and any Chrome-based apps (such as SSBs created by <a href="https://github.com/dmarmor/epichrome">Epichrome</a>)</p>
<p>Download: <a href="https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SendToOmniFocus.spoon.zip">https://github.com/Hammerspoon/Spoons/raw/master/Spoons/SendToOmniFocus.spoon.zip</a></p>

      </header>
      <h3>API Overview</h3>
      <ul>
        <li>Variables - Configurable values</li>
          <ul>
            <li><a href="#actions">actions</a></li>
            <li><a href="#logger">logger</a></li>
            <li><a href="#notifications">notifications</a></li>
            <li><a href="#quickentrydialog">quickentrydialog</a></li>
          </ul>
        <li>Methods - API calls which can only be made on an object returned by a constructor</li>
          <ul>
            <li><a href="#bindHotkeys">bindHotkeys</a></li>
            <li><a href="#registerApplication">registerApplication</a></li>
            <li><a href="#sendCurrentItem">sendCurrentItem</a></li>
          </ul>
      </ul>
      <h3>API Documentation</h3>
        <h4 class="documentation-section">Variables</h4>
          <section id="actions">
            <a name="//apple_ref/cpp/Variable/actions" class="dashAnchor"></a>
            <h5><a href="#actions">actions</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>SendToOmniFocus.actions</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Table containing application handlers for sending the current item to OmniFocus.</p>
</td>
              </tr>
              <tr>
                  <th>Notes</th>
                  <td><ul>
<li>Each entry's key is the application name, and its value is another table with the following keys:</li>
<li><code>itemname</code> - how to name the current item in the context of the application. Purely for cosmetic purposes in the notifications (e.g. in Mail, the notification says &quot;filing message&quot; instead of &quot;filing item&quot;. Defaults to &quot;item&quot;.</li>
<li>One of the following, invoked to do the actual filing:<ul>
<li><code>as_scriptfile</code> - path of a file containing AppleScript code. It will be executed using the <code>osascript</code> command. If <code>quickentrydialog</code> is set to <code>false</code>, the string <code>nodialog</code> will be passed as argument to the script.</li>
<li><code>as_script</code> - string containing AppleScript code. There is no way to pass an argument to the script via this method.</li>
<li><code>fn</code> - a function. It will be passed a boolean indicating the value of <code>quickentrydialog</code>.</li>
<li><code>apptype</code> - a predefined &quot;application type&quot; to trigger different behavior for application families. The only valid value at the moment is &quot;chromeapp&quot;, which can be used for any Chrome-based applications, including Google Chrome itself and, for example, any site-specific browsers generated using <a href="https://github.com/dmarmor/epichrome">Epichrome</a>.</li>
</ul>
</li>
<li>The built-in handlers for Outlook, Evernote, Chrome and Mail are implemented by scripts bundled with the SendToOmniFocus spoon.</li>
<li>New handlers can be registered using <code>SendToOmniFocus:registerApplication()</code></li>
<li>Default value:</li>
</ul>

<pre><code>  {
     [&quot;Microsoft Outlook&quot;] = {
        as_scriptfile = _resource_path(&quot;scripts/outlook-to-omnifocus.applescript&quot;),
        itemname = &quot;message&quot;
     },
     Evernote = {
        as_scriptfile = _resource_path(&quot;scripts/evernote-to-omnifocus.applescript&quot;),
        itemname = &quot;note&quot;
     },
     [&quot;Google Chrome&quot;] = {
        apptype = &quot;chromeapp&quot;,
        itemname = &quot;tab&quot;
     },
     Mail = {
        as_scriptfile = _resource_path(&quot;scripts/mail-to-omnifocus.applescript&quot;),
        itemname = &quot;message&quot;
     }
  }
</code></pre>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/SendToOmniFocus.spoon/init.lua#L65">Source/SendToOmniFocus.spoon/init.lua line 65</a></td>
              </tr>
            </table>
          </section>
          <section id="logger">
            <a name="//apple_ref/cpp/Variable/logger" class="dashAnchor"></a>
            <h5><a href="#logger">logger</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>SendToOmniFocus.logger</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/SendToOmniFocus.spoon/init.lua#L50">Source/SendToOmniFocus.spoon/init.lua line 50</a></td>
              </tr>
            </table>
          </section>
          <section id="notifications">
            <a name="//apple_ref/cpp/Variable/notifications" class="dashAnchor"></a>
            <h5><a href="#notifications">notifications</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>SendToOmniFocus.notifications</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Boolean to control Hammerspoon-generated notifications when filing items (doest not control AppleScript notifications, if any, generated from within the scripts). Defaults to <code>true</code>.</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/SendToOmniFocus.spoon/init.lua#L55">Source/SendToOmniFocus.spoon/init.lua line 55</a></td>
              </tr>
            </table>
          </section>
          <section id="quickentrydialog">
            <a name="//apple_ref/cpp/Variable/quickentrydialog" class="dashAnchor"></a>
            <h5><a href="#quickentrydialog">quickentrydialog</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>SendToOmniFocus.quickentrydialog</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Variable</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Whether to display the new tasks in the OmniFocus quick-entry dialog before adding them. Defaults to <code>true</code> (set to <code>false</code> to send directly to the Inbox, without prompting)</p>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/SendToOmniFocus.spoon/init.lua#L60">Source/SendToOmniFocus.spoon/init.lua line 60</a></td>
              </tr>
            </table>
          </section>
        <h4 class="documentation-section">Methods</h4>
          <section id="bindHotkeys">
            <a name="//apple_ref/cpp/Method/bindHotkeys" class="dashAnchor"></a>
            <h5><a href="#bindHotkeys">bindHotkeys</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>SendToOmniFocus:bindHotkeys(mapping)</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Binds hotkeys for SendToOmniFocus</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>mapping - A table containing hotkey objifier/key details for the following items:<ul>
<li>send_to_omnifocus - file current item to OmniFocus.</li>
</ul>
</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td></td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/SendToOmniFocus.spoon/init.lua#L201">Source/SendToOmniFocus.spoon/init.lua line 201</a></td>
              </tr>
            </table>
          </section>
          <section id="registerApplication">
            <a name="//apple_ref/cpp/Method/registerApplication" class="dashAnchor"></a>
            <h5><a href="#registerApplication">registerApplication</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>SendToOmniFocus:registerApplication(app, handlerSpec)</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Register a new application handler</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>app - application name</li>
<li>handlerSpec - a handler definition in the format of <code>SendToOmniFocus.actions</code>, or <code>nil</code> to unregister the application.</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td></td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/SendToOmniFocus.spoon/init.lua#L190">Source/SendToOmniFocus.spoon/init.lua line 190</a></td>
              </tr>
            </table>
          </section>
          <section id="sendCurrentItem">
            <a name="//apple_ref/cpp/Method/sendCurrentItem" class="dashAnchor"></a>
            <h5><a href="#sendCurrentItem">sendCurrentItem</a></h5>
            <table>
              <tr>
                <th>Signature</th>
                <td><code>SendToOmniFocus:sendCurrentItem()</code></td>
              </tr>
              <tr>
                <th>Type</th>
                <td>Method</td>
              </tr>
              <tr>
                <th>Description</th>
                <td><p>Send current item in current application to OmniFocus by triggering the appropriate handler.</p>
</td>
              </tr>
              <tr>
                  <th>Parameters</th>
                  <td><ul>
<li>None</li>
</ul>
</td>
              </tr>
              <tr>
                  <th>Returns</th>
                  <td><ul>
<li>The SendToOmniFocus object</li>
</ul>
</td>
              </tr>
              <tr>
                <th>Source</th>
                <td><a href="https://github.com/Hammerspoon/Spoons/blob/master/Source/SendToOmniFocus.spoon/init.lua#L135">Source/SendToOmniFocus.spoon/init.lua line 135</a></td>
              </tr>
            </table>
          </section>
  </body>
</html>